Package edu.uky.ai.lp.ai
Class HumanAgent
java.lang.Object
edu.uky.ai.lp.ai.HumanAgent
- All Implemented Interfaces:
Agent
public class HumanAgent extends java.lang.Object implements Agent
An implementation of
Agent that allows a human to play the game by
typing commands into the console.- Author:
- Stephen G. Ware
-
Constructor Summary
Constructors Constructor Description HumanAgent(Console console)Creates a new human agent which accepts input via the console. -
Method Summary
Modifier and Type Method Description ActionchooseAction(Game game)Chooses the next move for the player to make.voidobserve(Result result)Alerts the player to the result of the most recent action.
-
Constructor Details
-
HumanAgent
Creates a new human agent which accepts input via the console.- Parameters:
console- the console from which to get input- Throws:
java.io.IOException- if an I/O exception occurs
-
-
Method Details
-
chooseAction
Description copied from interface:AgentChooses the next move for the player to make.- Specified by:
chooseActionin interfaceAgent- Parameters:
game- the current state of the game- Returns:
- the action the player should take
-
observe
Description copied from interface:AgentAlerts the player to the result of the most recent action.
-